package com.cloud.common.exception;

import com.cloud.common.base.enums.ApiBaseEnum;

/**
 * @author: Dream_xun
 * @date: 2020/7/31 18:06
 * @description: 统一业务抛出异常
 */
public class BizException extends RuntimeException {

    private static final long serialVersionUID = -653112170620824445L;

    private final ApiBaseEnum apiBaseEnum;

    private String customMsg;

    public BizException(ApiBaseEnum apiBaseEnum, String customMsg) {
        super(customMsg);
        this.customMsg = customMsg;
        this.apiBaseEnum = apiBaseEnum;
    }

    public BizException(ApiBaseEnum apiBaseEnum) {
        super(apiBaseEnum.getNote());
        this.apiBaseEnum = apiBaseEnum;
    }

    public ApiBaseEnum getApiEnum() {
        return this.apiBaseEnum;
    }

    public String getCustomMsg() {
        return customMsg;
    }
}
